/* GSManufactureModifyInitAction2.java
 *
 * Project/Product: JZCG-XMBUS
 *
 * Modify Information:
 * =============================================================================
 *   Author	Date       Description
 *   ----------	---------- ---------------------------------------------------
 *   peng.ning	2008-9-28	First release
 *
 * Licensed Materials - Property of APEP
 * =============================================================================
 *    (C) COPYRIGHT Shanghai Auto Mart E-Procurement Co., Ltd. 2007 - 2008
 *    All Rights Reserved.
 *
 *    This software is the confidential and proprietary information of
 *    Shanghai Auto Mart E-Procurement Co., Ltd. ("Confidential Information").
 *    You shall not disclose such Confidential Information and shall use it only
 *    in accordance with the terms of the license agreement you entered into 
 *    with Shanghai Auto Mart E-Procurement Co., Ltd.
 *
 * Noties:
 * =============================================================================
 * 
 */

package com.hitrust.gs.action;

import java.util.HashMap;

import com.hitrust.gs.bean.GSManufactureBean;
import com.hitrust.gs.bean.GSManufactureCategoryBean;
import com.hitrust.gs.bean.GSProductStorageApepBean;
import com.hitrust.gs.business.GSManufactureCategoryProcessor;
import com.hitrust.gs.business.GSManufactureProcessor;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.service.GSBaseManager;

public class GSManufactureModifyInitAction2 extends GSBaseAction {

    /* (non-Javadoc)
     * @see com.hitrust.gs.service.GSBaseAction#execute(com.hitrust.gs.service.GSBaseForm)
     */
    public String execute(GSBaseForm aForm) throws Exception {
        GSManufactureProcessor tGSManufProcessor = new GSManufactureProcessor();
        GSManufactureCategoryProcessor tGSManufactureCategoryProcessor=new GSManufactureCategoryProcessor();
        // 检查库存
        
        // 种类等级
        tGSManufProcessor.getManufactureOfLevel(aForm);
        // 产品明细
        String manufactureId = aForm.getRequest().getParameter("manufactureid");
        GSManufactureBean manubean = tGSManufProcessor.getManufactureDetail(manufactureId);
        String countBean = tGSManufProcessor.getProductCount(manubean.getGs_concentricity());
        aForm.getRequest().setAttribute("count", countBean);
        aForm.getRequest().setAttribute("manubean", manubean);
        //上级类别
        GSManufactureCategoryBean catBean=tGSManufactureCategoryProcessor.getCategory(manubean.getGs_manufacture_category_id());
        aForm.getRequest().setAttribute("catBean", catBean);
        //供应商名称
        String providerName=GSBaseManager.getProviderName(manubean.getGs_provider_id());
        aForm.getRequest().setAttribute("providerName", providerName);
        //附加属性
        String prope=manubean.getGs_appender_property();
        String[] str=null;
        String reg=";";
        HashMap map=new HashMap();
        if(prope!=null&&!prope.trim().equals("")){
            reg=prope.substring(prope.length()-1);
            str=prope.split(reg);
            String[] s=new String[2];
            for (int tI = 1; tI < 7; tI++) {
                boolean bl=false;
                for(int a=0;a<str.length;a++)
                {
                    s=str[a].split("：");
                    if(s.length<=1){
                        s=str[a].split(":");
                    }
                    if(s[0].equals("适用车型")){
                        bl=true;
                        map.put("pro1", s[1]);
                    }
                    if(s[0].equals("适用机型")){
                        bl=true;
                        map.put("pro2", s[1]);
                    }
                    if(s[0].equals("适用底盘")){
                        bl=true;
                        map.put("pro3", s[1]);
                    }
                    if(s[0].equals("级别特征")){
                        bl=true;
                        map.put("pro4", s[1]);
                    }
                    if(s[0].equals("材质")){
                        bl=true;
                        map.put("pro5", s[1]);
                    }
                    if(s[0].equals("其他属性")){
                        bl=true;
                        map.put("pro6", s[1]);
                    }
                }
                if(bl==false){
                    map.put("pro"+tI, "");
                }
            }
    }
        //增加配置文件 判断湖南巴士计划价
        if(GSBaseConstants.PLANPRICE.equals("true")){
            aForm.getRequest().setAttribute("isPlanprice", "1");
        }else{
            aForm.getRequest().setAttribute("isPlanprice", "0");
        }
        aForm.getRequest().setAttribute("prope", map);
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
